#include <iostream>
#include<unordered_set>
using namespace std;

int cha(int* &A, int l, int r)
{
	unordered_set<int>s;
	l--;
	r--;
	for (int i = l; i <= r; i++)
	{
		s.insert(A[i]);
	}
	return s.size();
}
void change(int* &A, int k, int x)
{
	A[k - 1] = x;
}
int main()
{
	int n,m;
	//cin >> n>>m;
	scanf_s("%d%d", &n,&m);
	int* A = new int[n];
	//输入贝壳种类
	for (int i = 0; i < n; i++)
	{
		scanf_s("%d", &A[i]);
		//cin >> A[i];
			
	}
	//操作m次
	int x, y, z;
	int re = 0;
	for (int i = 0; i < m; i++)
	{
		//cin >> x>>y>>z;
		scanf_s("%d%d%d", &x, &y,&z);
		if (x == 1)
		{
			//cout << (y ^ re) << " " << (z ^ re);
			re = cha(A, y ^ re, z ^ re);
			printf_s("%d\n",re);
			//cout << re << endl;
		}
		else
		{
			
			change(A, y ^ re, z ^ re);
			
		}
	}
}